package org.edu.modules.logistics.ct.service.impl;

import org.edu.common.base.BasePageDto;
import org.edu.common.base.BaseServiceImpl;
import org.edu.common.utils.ConvertUtils;
import org.edu.common.base.BaseServiceImpl;
import org.edu.modules.logistics.ct.mapper.VeHqCheckitemMapper;
import org.edu.modules.logistics.ct.entity.VeHqCheckitem;
import org.edu.modules.logistics.ct.dto.VeHqCheckitemDto;
import org.edu.modules.logistics.ct.service.VeHqCheckitemService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;


/**
 * 实现类
 */
@Service
public class VeHqCheckitemServiceImpl extends BaseServiceImpl<VeHqCheckitem, VeHqCheckitemMapper> implements VeHqCheckitemService {

    public IPage<VeHqCheckitemDto> pageDto(BasePageDto page, @Param(Constants.WRAPPER) Wrapper queryWrapper){
        return mapper.pageDto(page,queryWrapper);
    }
    /**
    * 查询实体类
    */
    public VeHqCheckitemDto findDtoById(String id) {
        VeHqCheckitem entity = super.findById(id);
        VeHqCheckitemDto dto = ConvertUtils.convertToDto(entity, VeHqCheckitemDto.class);
        return dto;
    }

    /**
    * 新增或者修改
    */
    public void insertOrUpdate(VeHqCheckitemDto dto,Boolean isAdd){
        if(isAdd){
            super.insert(dto);
        }else{
            super.update(dto);
        }
    }

}
